//
// Created by Castle-Moriarty on 2025/11/5.
//

#include <iostream>
using namespace std;

class Shape {
public:
    // 虚析构函数
    virtual ~Shape() = default;

    virtual void draw() {
        cout << "Drawing a shape" << endl;
    }
};

class Circle final : public Shape {
public:
    void draw() override {
        cout << "Drawing a Circle" << endl;
    }
};

class Square final : public Shape {
public:
    void draw() override {
        cout << "Drawing a Square" << endl;
    }
};

int main() {
    // virtual
    Circle c;
    Square sq;
    Shape *ptr1 = &c;
    Shape *ptr2 = &sq;

    ptr1->draw();
    ptr2->draw();

    return 0;
}
